Sep 4, 2013
The prime factors of 13195 are 5, 7, 13 and 29.
What is the largest prime factor of the number 600851475143 ?
import math
def primes_in(x):
= [True] * x
c for i in range(2, x / 2):
if c[i]:
for j in range(i * i, x, i):j
= False
c[j] = []
y for i in range(2, x):
if (c[i]):
y.append(i)return y
def solve(x):
= primes_in(int(math.sqrt(x)))
primes
= []
y for prime in primes:
if x % prime == 0:
y.append(prime)print y
print solve(600851475143)